Imports System.Data
Partial Class Content_RE006_1
    Inherits System.Web.UI.Page
    Dim cls_chq_wtd As PTY_DAT_CHQ_WTD
    Dim cls_chq As PTY_DAT_CHQ
    Dim cls_cash As PTY_DAT_CUR_CASH
    Dim cls_comp As PTY_DAT_COMP
    Dim cls_conn As Connect
    Dim fcn As CLS_FCN
    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
        cls_chq_wtd = New PTY_DAT_CHQ_WTD
        cls_chq = New PTY_DAT_CHQ
        cls_cash = New PTY_DAT_CUR_CASH
        cls_comp = New PTY_DAT_COMP
        cls_conn = New Connect
        fcn = New CLS_FCN
        Dim dt As New DataTable
        Me.lblEvent.Text = (cls_chq_wtd.InsertData(Me.txtChqNo.Text, Me.txtDate.Text, Session("user_id")))
        'cls_cash.InsertData(cls_chq.GetChqAmount(Me.txtChqNo.Text), fcn.GetDate(Me.txtDate.Text), Session("user_id"))
        '----------UPDATE COMP_STATUS----------'
        Dim SQL_CHK As String = "SELECT distinct c.COMP_ID " & _
                                "FROM PTY_DAT_COMP c,PTY_DAT_COMP_DTL cd," & _
                                "PTY_DAT_WTD w,PTY_DAT_CHQ ch " & _
                                "WHERE(c.COMP_ID = cd.COMP_ID) " & _
                                "AND w.WTD_ID=cd.WTD_ID " & _
                                "AND w.CHQ_ID=ch.CHQ_ID " & _
                                "AND ch.CHQ_NO='" & Me.txtChqNo.Text & "' "
        dt = cls_conn.GetData(SQL_CHK)
        Dim i As Integer
        For i = 0 To dt.Rows.Count - 1
            cls_comp.UpdateStatus(dt.Rows(i)("COMP_ID").ToString, "2")
        Next
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '-----Chect Authority--------
        Dim role_prg = "RE006"
        Dim user_id = Session("user_id")
        Dim cls_aut As New AUTHORITY

        If cls_aut.DoCheck(user_id, role_prg) = "0" Then
            Me.Response.Redirect("ERROR_AUT.aspx")
        End If
    End Sub
End Class
